using System;
using System.Collections.Generic;
using XenoGears.Reflection;
using XenoGears.Functional;

namespace Jink.Core.Converters.Context
{
    public class ConversionContextEntry
    {
        public Type Type { get; private set; }
        public Object Value { get; private set; }

        public String Name { get { return (String)Cookies.GetOrDefault("name"); } set { Cookies["name"] = value;}}
        public Dictionary<String, Object> Cookies { get; private set; }

        public ConversionContextEntry(Type type, Object value)
            : this(type, value, null)
        {
        }

        public ConversionContextEntry(Type type, Object value, Object pbag)
            : this(type, value, pbag.ToPropertyBag())
        {
        }

        public ConversionContextEntry(Type type, Object value, IDictionary<String, Object> cookies)
        {
            Type = type;
            Value = value;
            Cookies = cookies.ToDictionary() ?? new Dictionary<String, Object>();
        }
    }
}